package de.lunaplayer.repository;

import java.sql.*;

public class Database {
	
	private static Database instance = null;
	private Connection con;
	private Statement smt;

	public Database() {
		try {
			initialize();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	public static synchronized Database getInstance(){
		if(instance == null)
			instance = new Database();
		return instance;
	}

	private void initialize() throws ClassNotFoundException, SQLException {
		Class.forName("org.sqlite.JDBC");
		this.con = DriverManager.getConnection("jdbc:sqlite:mmusic.db");
		this.smt = con.createStatement();
		
	}

	public Connection getCon() {
		return con;
	}

	public Statement getSmt() {
		return smt;
	}




}

